Chrome Extension
activeTab
tabs activeTab permission 使
chrome.tabs.query({ active: true, currentWindow: true }, tabs => { const activeTab = tabs[0]; ... }

optional_permissions
Permission 使
Permission content script
manifest.json permission
"optional_permissions": ["http://*/*", "https://*/*"]
// ...
const origin = new URL(activeTab.url).origin + '/*';
chrome.permissions.request({
origins: [origin]
}, (res) => {
console.log(res); // true or false
});

optional_permissions
permission true
Chrome
chrome.permissions.{onAdded, onRemoved} listen

hrome.permissions.getAll(cb)

context menu
URL 使
content script addEventListener("contextmenu", ...) Listen
event page chrome.contextMenu.create update
contextmenu